DATA = {}

function DATA.get_game_type_name(key) 
    local game_type_name = {}
    game_type_name[130]    = "DOUNIU_HALL"
    game_type_name[210]    = "DDZ_HALL"
    game_type_name[230]    = "3JJ_HALL"
    game_type_name[232]    = "CS13_HALL"
    game_type_name[228]    = "PDK_HALL"
    game_type_name[212]    = "28_HALL"
    game_type_name[214]    = "13S_HALL"
    game_type_name[216]   = "FZMJ_HALL"
    game_type_name[218]   = "3ZP_HALL"
    game_type_name[220]   = "SZDD_HALL"
    game_type_name[222]   = "HZMJ_HALL"
    game_type_name[224]   = "DZPK_HALL"
    game_type_name[226]   = "SG_HALL"
    game_type_name[242]   = "SG_HALL100"
    if game_type_name[key] ~= nil then
        return game_type_name[key]
    end
end 
-- 添加扣除金钱 
function DATA.get_fang_ka(cost_name,pay_type) 
    local rs = 0  
    local switch = {  
        ["DOUNIU_HALL8"] = function()  
            return 1
        end,  
        ["DOUNIU_HALL16"] = function()  
            return 2
        end,   
        ["3ZP_HALL8"] = function()  
            return 1
        end,  
        ["3ZP_HALL16"] = function()  
            return 2
        end,   
        ["28_HALL8"] = function()  
            return 1
        end,  
        ["28_HALL16"] = function()  
            return 2
        end,   
        ["SG_HALL8"] = function()  
            return 1
        end,  
        ["SG_HALL16"] = function()  
            return 2
        end,    
        ["DZPK_HALL8"] = function()  
            return 1
        end,  
        ["DZPK_HALL16"] = function()  
            return 2
        end,   
        ["CS13_HALL8"] = function()  
            return 1
        end,  
        ["CS13_HALL16"] = function()  
            return 2
        end,  
        ["PDK_HALL8"] = function()  
            return 1
        end,  
        ["PDK_HALL16"] = function()  
            return 2
        end, 
        ["DDZ_HALL8"] = function()  
            return 1
        end,  
        ["DDZ_HALL16"] = function()  
            return 2
        end,  
        ["3JJ_HALL8"] = function()  
            return 1
        end,  
        ["3JJ_HALL16"] = function()  
            return 2
        end,   
        ["HZMJ_HALL8"] = function()  
            return 1
        end,  
        ["HZMJ_HALL16"] = function()  
            return 2
        end,   
        ["SG_HALL1008"] = function()  
            return 1
        end,  
        ["SG_HALL10016"] = function()  
            return 2
        end,     
    }   
    local switch2 = {  
        ["DOUNIU_HALL8"] = function()  
            return 3
        end,  
        ["DOUNIU_HALL16"] = function()  
            return 6
        end,   
        ["3ZP_HALL8"] = function()  
            return 3
        end,  
        ["3ZP_HALL16"] = function()  
            return 6
        end,   
        ["28_HALL8"] = function()  
            return 3
        end,  
        ["28_HALL16"] = function()  
            return 6
        end,  
        ["SG_HALL8"] = function()  
            return 3
        end,  
        ["SG_HALL16"] = function()  
            return 6
        end,   
        ["DZPK_HALL8"] = function()  
            return 3
        end,  
        ["DZPK_HALL16"] = function()  
            return 6
        end,   
        ["CS13_HALL8"] = function()  
            return 3
        end,  
        ["CS13_HALL16"] = function()  
            return 6
        end,  
        ["PDK_HALL8"] = function()  
            return 3
        end,  
        ["PDK_HALL16"] = function()  
            return 6
        end, 
        ["DDZ_HALL8"] = function()  
            return 3
        end,  
        ["DDZ_HALL16"] = function()  
            return 6
        end,  
        ["3JJ_HALL8"] = function()  
            return 3
        end,  
        ["3JJ_HALL16"] = function()  
            return 6
        end,   
        ["HZMJ_HALL8"] = function()  
            return 3
        end,  
        ["HZMJ_HALL16"] = function()  
            return 6
        end,  
        ["SG_HALL1008"] = function()  
            return 3
        end,  
        ["SG_HALL10016"] = function()  
            return 6
        end,  
    }   
    local fSwitch = nil
    if pay_type == 0 then 
        fSwitch = switch[cost_name]  
    else 
        fSwitch = switch2[cost_name]  
    end 
    if fSwitch then --key exists   
        rs = fSwitch() --do func   
    end  
    if rs < 1 then
        rs = 1
        if pay_type == 1 then
            rs = 3
        end
    end
    rs = 1
    return rs
end 


-- 添加扣除金钱 
function DATA.get_ji_fen(data) 
    if data.game_type == nil and data.gameType ~= nil then
        data.game_type = data.gameType
    end
    if data.room_odds == nil or data.room_odds < 1 then
        data.room_odds = 1
    end
    data.game_type = math.floor(data.game_type)
    local ji_fen_time = 0  --每次扣分
    local jifen_sit_need = 0  --坐下最低分数
    local switch1 = {  
        [130] = function()  
            local ji_fen_time = 5  
            local jifen_sit_need = 0   
            local tmp = 2
            if data.optionType ~= "00000000" then
                tmp = 4
            end
            if data.score_type == 1 then
                tmp = 3
                if data.optionType ~= "00000000" then
                    tmp = 4
                end
            elseif data.score_type == 2 then 
                tmp = 6
                if data.optionType ~= "00000000" then
                    tmp = 6
                end
            end
            if data.max_player_num ~= nil and data.max_player_num == 9 then
                if tmp == 4 then
                    tmp = 3
                end
                jifen_sit_need = tmp * 100 * data.room_odds
            else
                jifen_sit_need = tmp * 50 * data.room_odds
            end   
            return ji_fen_time,jifen_sit_need
        end,   
        [210] = function()  --斗地主
            local ji_fen_time = 8  
            local jifen_sit_need = 0  
            jifen_sit_need = 300 * data.room_odds
            if data.room_odds == 1 then 
                jifen_sit_need = 300
            elseif data.room_odds == 2 then 
                jifen_sit_need = 600
            elseif data.room_odds == 3 then 
                jifen_sit_need = 1000
            elseif data.room_odds == 4 then 
                jifen_sit_need = 1500
            elseif data.room_odds == 5 then 
                jifen_sit_need = 2000
            end
            return ji_fen_time,jifen_sit_need
        end,  
        [212] = function()  --28杠
            local ji_fen_time = 5  
            local jifen_sit_need = 0   
            jifen_sit_need = 500 
            if data.odds_type ~= nil and data.odds_type == 1 then
                jifen_sit_need = 800
            elseif data.odds_type ~= nil and data.odds_type == 2 then
                jifen_sit_need = 1000
            end
            if data.score_type ~= nil and data.score_type == 1 then
                jifen_sit_need = 1500 
                if data.odds_type ~= nil and data.odds_type == 1 then
                    jifen_sit_need = 2000
                elseif data.odds_type ~= nil and data.odds_type == 2 then
                    jifen_sit_need = 3000
                end
            end
            jifen_sit_need = jifen_sit_need * data.room_odds
            return ji_fen_time,jifen_sit_need
        end,    
        [218] = function()  --三张牌
            local ji_fen_time = 5  
            local jifen_sit_need = 0  
            jifen_sit_need = 150 * data.room_odds 
            return ji_fen_time,jifen_sit_need
        end,  
        [222] = function()  --红中麻将
            local ji_fen_time = 8  
            local jifen_sit_need = 10  
            jifen_sit_need = jifen_sit_need * data.room_odds 
            return ji_fen_time,jifen_sit_need
        end,    
        [226] = function()  --三公
            local ji_fen_time = 5  
            local jifen_sit_need = 0   
            jifen_sit_need = 500 
            if data.optionType ~= "00" then
                tmp = 1000
            end
            jifen_sit_need = jifen_sit_need * data.room_odds 
            return ji_fen_time,jifen_sit_need
        end,  
        [228] = function()  --跑得快
            local ji_fen_time = 8  
            local jifen_sit_need = 0   
            jifen_sit_need = 80 
            if data.optionType ~= "0" then
                tmp = 100
            end
            jifen_sit_need = jifen_sit_need * data.room_odds 
            return ji_fen_time,jifen_sit_need
        end,  
        [230] = function()  --廉江三脚鸡
            local ji_fen_time = 8  
            local jifen_sit_need = 0   
            jifen_sit_need = 6 * data.room_odds 
            return ji_fen_time,jifen_sit_need
        end,  
        [232] = function()  --潮汕十三张
            local ji_fen_time = 8  
            local jifen_sit_need = 0   
            if data.zha_dan_max ~= nil and data.zha_dan_max == 3 then
                jifen_sit_need = 200
            elseif data.zha_dan_max ~= nil and data.zha_dan_max == 4 then
                jifen_sit_need = 300
            elseif data.zha_dan_max ~= nil and data.zha_dan_max == 5 then
                jifen_sit_need = 500
            else
                jifen_sit_need = 500
            end
            jifen_sit_need = jifen_sit_need * data.room_odds 
            return ji_fen_time,jifen_sit_need
        end,  
        [242] = function()  --三公100
            local ji_fen_time = 5  
            local jifen_sit_need = 4000   
            jifen_sit_need = jifen_sit_need * data.room_odds 
            return ji_fen_time,jifen_sit_need
        end,  
    }    
    local switch2 = {  
        [130] = function()  
            return 2,2
        end,     
    }     
    local fSwitch = nil 
    if data.club_type == 1 and switch1[data.game_type] ~= nil then 
        fSwitch = switch1[data.game_type] 
    elseif (data.club_type == 2 or data.club_type == 5 ) and switch1[data.game_type] ~= nil then
        fSwitch = switch1[data.game_type] 
        -- print('===ji_fen_time,jifen_sit_need===11111===',ji_fen_time,jifen_sit_need,data.game_type,data.club_type) 
    end   
    if fSwitch ~= nil then --key exists   
        ji_fen_time,jifen_sit_need = fSwitch() --do func    
    end   
    
    if ji_fen_time <  5 then
        ji_fen_time = 5
    end
    -- print('===ji_fen_time,jifen_sit_need===555===',ji_fen_time,jifen_sit_need,data.game_type,data.club_type)
    return ji_fen_time,jifen_sit_need
end 


return DATA
